package com.ruoyi;

import com.ruoyi.langchain4j.assistant.Assistant;
import dev.langchain4j.model.ollama.OllamaChatModel;
import dev.langchain4j.service.AiServices;
import dev.langchain4j.service.spring.AiService;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

/**
 * @description:
 * @author: lizhihua
 * @date: 2025/6/7
 */
@SpringBootTest
public class AiServiceDemo {

    @Autowired
    private OllamaChatModel ollamaChatModel;
    @Autowired
    private Assistant assistant;

    @Test
    public void test() {
        Assistant assistant = AiServices.create(Assistant.class, ollamaChatModel);
        String chat = assistant.chat("你是谁?");
        System.out.println(chat);
    }

    @Test
    public void test1() {
        String chat = assistant.chat("你是谁?");
        System.out.println(chat);
    }
}
